﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace MineSweeperCheater.Test
{
  [TestFixture]
  class TestCreateEmptyCheatField
  {
    [Test]
    public void With0Rows0Cols()
    {
      var input = new Cheater.FieldDimensions() { Rows = 0, Cols = 0 };
      var result = Cheater.CreateEmptyCheatField(input);
      var expected = new int[0, 0];

      Assert.That(result, Is.EqualTo(expected));
    }
    [Test]
    public void With5Rows0Cols()
    {
      var input = new Cheater.FieldDimensions() { Rows = 5, Cols = 0 };
      var result = Cheater.CreateEmptyCheatField(input);
      var expected = new int[5, 0];

      Assert.That(result, Is.EqualTo(expected));
    }
    [Test]
    public void With0Rows7Cols()
    {
      var input = new Cheater.FieldDimensions() { Rows = 0, Cols = 7 };
      var result = Cheater.CreateEmptyCheatField(input);
      var expected = new int[0, 7];

      Assert.That(result, Is.EqualTo(expected));
    }
    [Test]
    public void With38Rows3Cols()
    {
      var input = new Cheater.FieldDimensions() { Rows = 38, Cols = 3 };
      var result = Cheater.CreateEmptyCheatField(input);
      var expected = new int[38, 3];

      Assert.That(result, Is.EqualTo(expected));
    }

    public void DelegateWithNegativeRows()
    {
      var input = new Cheater.FieldDimensions() { Rows = -38, Cols = 3 };
      Cheater.CreateEmptyCheatField(input);
    }

    [Test]
    public void WithNegativeRows()
    {
      Assert.Throws<OverflowException>(DelegateWithNegativeRows);
    }

    public void DelegateWithNegativeCols()
    {
      var input = new Cheater.FieldDimensions() { Rows = 38, Cols = -3 };
      Cheater.CreateEmptyCheatField(input);
    }

    [Test]
    public void WithNegativeCols()
    {
      Assert.Throws<OverflowException>(DelegateWithNegativeCols);
    }


  }
}
